<template>
  <a-card :bordered="false">
    <!-- 默认全换成 include需要缓存的页面名字merCouponList -->
    <!--<keep-alive include="companyList">-->
    <component @onEdit="handleEdit" @onGoBack="handleGoBack" :record="record"
               :is="currentComponet"></component>
    <!--</keep-alive>-->
  </a-card>
</template>

<script>
  import customerEdit from './customerEdit'
  import customerList from './customerList'

  export default {
    name: 'info',
    components: {
      customerEdit,
      customerList
    },
    data () {
      return {
        currentComponet: 'customerList',
        record: ''
      }
    },
    methods: {
      handleEdit (record) {
        if (record == 'null') { //新建
          this.record = ''
        } else {
          this.record = record
        }
        this.currentComponet = 'customerEdit'
      },
      handleGoBack () {
        this.record = ''
        this.currentComponet = 'customerList'
      }

    },
    watch: {
      '$route.path' () {
        this.record = ''
        this.currentComponet = 'customerList'
      }
    }
  }
</script>